package com.atguigu.tingshu.comment.api;

import com.atguigu.tingshu.comment.service.CommentService;
import com.atguigu.tingshu.common.login.GuiLogin;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.vo.comment.CommentVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "专辑评论管理")
@RestController
@RequestMapping("/api/comment")
@Slf4j
public class CommentApiController {

	@Autowired
	private CommentService commentService;


	@GuiLogin
	@PostMapping("/save")
	public Result save (@RequestBody CommentVo commentVo){
		commentService.save(commentVo);
		return Result.ok();
	}

	@GetMapping("/findCommentPage/{albumId}/{trackId}/{page}/{limit}")
	public Result findCommentPage(@PathVariable(value = "albumId")Long albumId,
								  @PathVariable(value = "trackId")Long trackId,
								  @PathVariable(value = "page")Long page,
								  @PathVariable(value = "limit")Long limit){
		return Result.ok(commentService.findCommentPage(albumId,trackId,page,limit));
	}

}

